package com.glory.erp.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description: 生成订单号
 * @Title: NumUtil.java
 * @Author: 樊双峰
 * @Date: 2018年5月31日 下午11:27:52
 * @Version V1.0
 */
public class NumUtil {

	public static int serNum = 1;
	public static int len = 7;
	private static final byte[] zeros = {48,48,48,48,48,48}; // 6个0
	
	public static final String generatorOrderNum(){
		Date date = new Date();
		DateFormat df = new SimpleDateFormat("yyMMdd");
		String fir = df.format(date);
		int num = serNum++;
		int len2 = (num+"").length();
		String sec = new String(zeros,0,len-len2);
		return fir+sec+num;
	}
	
	public static void main(String[] args) {
		System.out.println(generatorOrderNum());
		System.out.println(generatorOrderNum());
		System.out.println(generatorOrderNum());
	}
}